﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace MapEditor.Forms
{
    public partial class NewMapForm : Form
    {
        //Declare map and tile dimensions
        public int FL1Height;
        public int FL1Width;
        public int FL1TileHeight;
        public int FL1TileWidth;
        public int FL1TileType;

        public int FL2Height;
        public int FL2Width;
        public int FL2TileHeight;
        public int FL2TileWidth;
        public int FL2TileType;

        public int FL3Height;
        public int FL3Width;
        public int FL3TileHeight;
        public int FL3TileWidth;
        public int FL3TileType;

        public int EnemyHeight;
        public int EnemyWidth;
        public int EnemyTileHeight;
        public int EnemyTileWidth;
        public int EnemyTileType;

        public int PlayerHeight;
        public int PlayerWidth;
        public int PlayerTileHeight;
        public int PlayerTileWidth;
        public int PlayerTileType;

        public int ScreenHeight;
        public int ScreenWidth;
        public int ScreenTileHeight;
        public int ScreenTileWidth;
        public int ScreenTileType;

        public int BG1Height;
        public int BG1Width;
        public int BG1TileHeight;
        public int BG1TileWidth;
        public int BG1TileType;

        public int BG2Height;
        public int BG2Width;
        public int BG2TileHeight;
        public int BG2TileWidth;
        public int BG2TileType;

        public int BG3Height;
        public int BG3Width;
        public int BG3TileHeight;
        public int BG3TileWidth;
        public int BG3TileType;

        public String mapName;

        public NewMapForm()
        {
            InitializeComponent();
        }
        private void label1_Click(object sender, EventArgs e)
        {

        }

        private void cancelButton_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
        }

        private void okButton_Click_1(object sender, EventArgs e)
        {
            mapName = MapNameText.Text;

            FL1Height = Convert.ToInt32(FrontHeight1.Value);
            FL1Width = Convert.ToInt32(FrontWidth1.Value);
            FL1TileHeight = Convert.ToInt32(Front1TileHeight.Value);
            FL1TileWidth = Convert.ToInt32(Front1TileWidth.Value);
            if (FL1Type.SelectedItem.ToString() == "tiles")
            {
                FL1TileType = 0;
            }
            else
            {
                FL1TileType = 1;
            }

            FL2Height = Convert.ToInt32(FrontHeight2.Value);
            FL2Width = Convert.ToInt32(FrontWidth2.Value);
            FL2TileHeight = Convert.ToInt32(Front2TileHeight.Value);
            FL2TileWidth = Convert.ToInt32(Front2TileWidth.Value);
            if (FL2Type.SelectedItem.ToString() == "tiles")
            {
                FL2TileType = 0;
            }
            else
            {
                FL2TileType = 1;
            }

            FL3Height = Convert.ToInt32(FrontHeight3.Value);
            FL3Width = Convert.ToInt32(FrontWidth3.Value);
            FL3TileHeight = Convert.ToInt32(Front3TileHeight.Value);
            FL3TileWidth = Convert.ToInt32(Front3TileWidth.Value);
            if (FL3Type.SelectedItem.ToString() == "tiles")
            {
                FL3TileType = 0;
            }
            else
            {
                FL3TileType = 1;
            }

            EnemyHeight = Convert.ToInt32(EnemyHeightBox.Value);
            EnemyWidth = Convert.ToInt32(EnemyWidthBox.Value);
            EnemyTileHeight = Convert.ToInt32(EnTileHeight.Value);
            EnemyTileWidth = Convert.ToInt32(EnTileWidth.Value);
            if (ENType.SelectedItem.ToString() == "tiles")
            {
                EnemyTileType = 0;
            }
            else
            {
                EnemyTileType = 1;
            }

            PlayerHeight = Convert.ToInt32(PlayerHeightBox.Value);
            PlayerWidth = Convert.ToInt32(PlayerWidthBox.Value);
            PlayerTileHeight = Convert.ToInt32(PLTileHeight.Value);
            PlayerTileWidth = Convert.ToInt32(PLTileWidth.Value);
            if (PLType.SelectedItem.ToString() == "tiles")
            {
                PlayerTileType = 0;
            }
            else
            {
                PlayerTileType = 1;
            }

            ScreenHeight = Convert.ToInt32(ScreenHeightBox.Value);
            ScreenWidth = Convert.ToInt32(ScreenWidthBox.Value);
            ScreenTileHeight = Convert.ToInt32(SCTileHeight.Value);
            ScreenTileWidth = Convert.ToInt32(SCTileWidth.Value);
            if (SCType.SelectedItem.ToString() == "tiles")
            {
                ScreenTileType = 0;
            }
            else
            {
                ScreenTileType = 1;
            }

            BG1Height = Convert.ToInt32(BGHeight1.Value);
            BG1Width = Convert.ToInt32(BGWidth1.Value);
            BG1TileHeight = Convert.ToInt32(Back1TileHeight.Value);
            BG1TileWidth = Convert.ToInt32(Back1TileWidth.Value);
            if (BG1Type.SelectedItem.ToString() == "tiles")
            {
                BG1TileType = 0;
            }
            else
            {
                BG1TileType = 1;
            }

            BG2Height = Convert.ToInt32(BGHeight2.Value);
            BG2Width = Convert.ToInt32(BGWidth2.Value);
            BG2TileHeight = Convert.ToInt32(Back2TileHeight.Value);
            BG2TileWidth = Convert.ToInt32(Back2TileWidth.Value);
            if (BG2Type.SelectedItem.ToString() == "tiles")
            {
                BG2TileType = 0;
            }
            else
            {
                BG2TileType = 1;
            }

            BG3Height = Convert.ToInt32(BGHeight3.Value);
            BG3Width = Convert.ToInt32(BGWidth3.Value);
            BG3TileHeight = Convert.ToInt32(Back3TileHeight.Value);
            BG3TileWidth = Convert.ToInt32(Back3TileWidth.Value);
            if (BG3Type.SelectedItem.ToString() == "tiles")
            {
                BG3TileType = 0;
            }
            else
            {
                BG3TileType = 1;
            }

            //Set dialog result to ok
            this.DialogResult = DialogResult.OK;
        }
    }
}
